home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-03-30 | 1.6 KB | 53 lines | [TEXT/MMCC] |
- // ===========================================================================
- // UScripting.h -- support class for scripting
- // ===========================================================================
- // © 1995 James Kaput, Jeremy Roschelle SimCalc Project
-
- #pragma once
-
- #include <osa.h>
-
- class UScripting{
- public:
-
- // call this once at app launch time
- static void Initialize();
-
- // get/set default component
- static ComponentInstance GetComponent()
- {return sComponent;};
- static void SetComponent(ComponentInstance inComponent)
- {sComponent = inComponent;};
-
- // returns a handle to the 'scpt' and 'TEXT' resource
- // you should pass in pointers to unallocated handles
- // this routine will set the handles to nil if it can't find or allocate them
- static OSErr ParseScriptFile(FSSpec &inFile, Handle &outScript, Handle &outText);
-
- // will make a ScriptEditor file
- static OSErr CreateScriptFile(FSSpec &inFile,Handle inScript, Handle inText);
-
- // load, execute and dispose a script
- static OSErr LoadScript(Handle inScript, OSAID &outScriptID);
- static OSErr LoadScript(AEDesc &inScriptDesc, OSAID &outScriptID);
- static OSErr ExecuteScript(OSAID inScriptID);
- static OSErr DisposeScript(OSAID inScriptID);
-
- private:
- static ComponentInstance sComponent;
-
-
- };
-
- // note: the purpose of this class is to execute a script once
- // at the end of the processing of the current event
- class URun1Script : public LPeriodical
- {
- public:
- URun1Script(OSAID inScriptID);
- virtual void SpendTime(const EventRecord &inMacEvent);
-
- protected:
- OSAID mScriptID;
- };
-